package com.fairisanddog.controller;

import com.alibaba.fastjson.JSON;

import com.fairisanddog.entity.Shoes;
import com.fairisanddog.service.ShoesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/shoes")
public class ShoesController {
    @Autowired
    @Qualifier("ShoesServiceImpl")
    private ShoesService shoesService;


    @RequestMapping("/findAllShoes")
    @ResponseBody
    public String queryAllShoes(){
            List<Shoes> shoes = shoesService.queryAllShoes();
            if (null!=shoes){
                return JSON.toJSONString(shoes);
            }else {
                return "no";
            }
    }
}
